<template>
  <div class="page">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>综合素质测评</span>
      </div>
      <div>
        <el-table
          :data="tableData"
          border
          stripe
          style="width: 100%">
          <el-table-column
            prop="name"
            label="姓名"
            width="80"
            >
          </el-table-column>
          <el-table-column
            prop="identitycard"
            label="身份证号"
            >
          </el-table-column>
          <el-table-column
            prop="sex"
            label="性别"
            width="80">
          </el-table-column>
          <el-table-column
            prop="grade"
            label="年级"
            width="80">
          </el-table-column>
          <el-table-column
            prop="phone"
            label="手机号码"
            width="120">
          </el-table-column>
          <el-table-column
            prop="score"
            label="素质测评分数">
          </el-table-column>
          <el-table-column
            prop="address"
            label="操作">
            <template slot-scope="scope">
              <el-button @click="totest" type="text">进入测评</el-button>
              | 
              <span @click="tongbu">同步分数</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
    <div class="tips">
      <b>温馨提示：</b>
      <p>1．请务必使用谷歌Chrome浏览器进行素质测评。</p>
      <p>2．素质测评初始登陆账号为：身份证号，初始密码为：手机号码。请牢记，并务必不要做任何修改。</p>
      <p>3．如意外退出考试，请在登陆测评系统后，点击左侧“我的测评”，找到相对应的考试，继续进行考试。</p>
      <p>4．如想重新查看测试成绩，请在登陆测评系统后，点击左侧“我的测评”，选择相应考试查看即可。</p>
      <p>5．测试完成之后，请重新登陆系统或者刷新页面，进行下一步操作。</p>
    </div>
    <div>
      <el-button @click="pevs" type='primary' size="mini">上一步</el-button>
      <el-button type='primary' size="mini">保存</el-button>
      <!-- <el-button @click="nexts" type='primary' size="mini">下一步</el-button> -->
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
import { pev, next } from '@/function/pevNext/pevNext.js'
export default {
  data() {
    return {
      tableData: []
    }
  },
  mounted () {
    this.tongbu()
  },
  methods: {
    confirm() {
      sessionStorage.setItem('chose', true)
      this.$router.push('/authorInformation')
    },
    nexts() {
      // /filing/syn/score
      // this.$router.push('/index/researchProject')
      next(this)
    },
    pevs() {
      pev(this)
    },
    // 同步分数
    tongbu() {
      this.$http.get('/filing/score/student/get')
      .then((res) => {
        let data = []
        data.push(res.data)
        this.tableData = data
        this.$message({
          message: '同步成功！'
        })
        this.$confirm('是否继续下一步操作?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http.get("/filing/process/info").then(res => {
            if(res.data.process < 4) {
              this.$message('还未进行成绩测评或同步成绩失败')
              return
            }
            next(this)
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });          
        });

        
      })
    },
    // 进入测评
    totest() {
      window.open('http://www.stemcloud.cn/stemtestsys')
    }
  }
}
</script>

<style scoped lang="scss">
.page {
  height: 100%;
}
span {
  cursor: pointer;
}
@import './index.scss'; 
</style>
